{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 决策树的问题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn import datasets\n",
    "\n",
    "iris = datasets.load_iris()\n",
    "X = iris.data[:,2:]\n",
    "y = iris.target"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DecisionTreeClassifier(criterion='entropy', max_depth=2, random_state=42)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.tree import DecisionTreeClassifier\n",
    "\n",
    "tree_clf = DecisionTreeClassifier(max_depth=2, criterion=\"entropy\", random_state=42)\n",
    "tree_clf.fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_decision_boundary(model, axis):\n",
    "    \n",
    "    x0, x1 = np.meshgrid(\n",
    "        np.linspace(axis[0], axis[1], int((axis[1]-axis[0])*200)).reshape(-1, 1),\n",
    "        np.linspace(axis[2], axis[3], int((axis[3]-axis[2])*200)).reshape(-1, 1),\n",
    "    )\n",
    "    X_new = np.c_[x0.ravel(), x1.ravel()]\n",
    "\n",
    "    y_predict = model.predict(X_new)\n",
    "    zz = y_predict.reshape(x0.shape)\n",
    "\n",
    "    from matplotlib.colors import ListedColormap\n",
    "    custom_cmap = ListedColormap(['#EF9A9A','#FFF59D','#90CAF9'])\n",
    "    \n",
    "    plt.contourf(x0, x1, zz, linewidth=5, cmap=custom_cmap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/liuyubobobo/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:15: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  from ipykernel import kernelapp as app\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAcD0lEQVR4nO3de5Bc5Znf8e8zFyQ0jBhYSUggGdll7dqYxJI9kbGVclG7XoIkanE5JiXHsdcu1yp2wAXJVqWClTKX2PH+5URrHFQKkIVaL5SxsJcsYo23wi4XlwySLK0BkbKCl2iiQcNN0oxuMDNP/ugzM91nzkyfPn26z6V/n6opzXn77dMPQ82jo/f8+m1zd0REpPi6si5ARETSoYYuIlISaugiIiWhhi4iUhJq6CIiJaGGLiJSEnUbupktNLPnzOygmb1oZndEzDEz+1MzO2xmf29mH2lNuSIiMpeeGHPOAb/r7mNm1gs8Y2aPu/ueqjkbgTXB18eAu4M/RUSkTepeoXvFWHDYG3yF3410PfBAMHcPMGBmK9ItVURE5hPnCh0z6wb2Ae8Hvu/uvwhNuQw4UnU8FIwNh86zFdgK0LdgwUfXLF+esGxJ4s3zfyvrEkSkSUde3v+Guy+NeixWQ3f3CWCtmQ0APzazK939haopFvW0iPPsBHYCrFu92p/cti3Oy0tK7l/7h1mXICJNumX9glfneqyhlIu7Hwf+Frg29NAQsKrqeCVwtJFzi4hIc+KkXJYGV+aY2fnAp4CXQ9MeBb4YpF2uAk64+zAiItI2cZZcVgD3B+voXcAP3f2vzOyrAO6+A9gNbAIOA6eBL7eoXhERmUPdhu7ufw+sixjfUfW9AzemW5qIiDRC7xQVESkJNXQRkZJQQxcRKQk1dBGRklBDFxEpCTV0EZGSUEMXESkJNXQRkZJQQxcRKQk1dBGRklBDFxEpCTV0EZGSUEMXESkJNX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YoItKptOQiIlISaugiIiWhhi4iUhJq6CIiJaGGLiJSEmroIiIloYYuIlIS/x9YQl0gz1Aa9gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(tree_clf, axis=[0.5, 7.5, 0, 3])\n",
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.scatter(X[y==2,0], X[y==2,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_new = np.delete(X, 106, axis=0)\n",
    "y_new = np.delete(y, 106)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(149, 2)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_new.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DecisionTreeClassifier(criterion='entropy', max_depth=2, random_state=42)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tree_clf2 = DecisionTreeClassifier(max_depth=2, criterion=\"entropy\", random_state=42)\n",
    "tree_clf2.fit(X_new, y_new)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/liuyubobobo/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:15: UserWarning: The following kwargs were not used by contour: 'linewidth'\n",
      "  from ipykernel import kernelapp as app\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAAOX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NBFREpCDV1EpCTU0EVESkINXUSkJNTQRURKQg1dRKQk/j9ENnl+LQVScQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(tree_clf2, axis=[0.5, 7.5, 0, 3])\n",
    "plt.scatter(X_new[y_new==0,0], X_new[y_new==0,1])\n",
    "plt.scatter(X_new[y_new==1,0], X_new[y_new==1,1])\n",
    "plt.scatter(X_new[y_new==2,0], X_new[y_new==2,1])\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
